package com.http;

import java.util.List;

import org.json.JSONObject;

import android.os.AsyncTask;

import com.android.ocean.util.net.NetConUtil;
import com.android.ocean.util.net.ResEntity;
import com.common.method.ServerPath;
import com.modle.PyqUser;
import com.util.JsonUtil1;

/**
 * 
 * @ClassName:UserListTask
 * @Description:TODO获取用户列表
 * @author zhuw
 * @date 2013-8-4 下午5:20:45
 */
public class PyqListTask extends AsyncTask<String, Void, Object>{
	NetCallBack callBack;

	public PyqListTask(NetCallBack callBack) {
		super();
		this.callBack = callBack;
	}

	protected Object doInBackground(String... params) {
		Object data = null;
		try {
			ResEntity re = null;

			re = NetConUtil.sendGetRequestEntity(ServerPath.PYQ_PATH+params[0]+"?page="+params[1]);

			if (re.code == ResEntity.S_OK) {
				String arr = new JSONObject(re.jsonStr).get("data").toString();
				 List<PyqUser> users = JsonUtil1.parseArray(arr, PyqUser.class);
				 data = users;
				//data = new ResultUserList(CommonData.H_FLAG_SUCCESS, null,JsonUtil.parseNoReadMsgList(new JSONArray(re.jsonStr),params[0]));
			} else if (re.code == ResEntity.S_FAILED) {

//				data = new ResultUserList(CommonData.H_FLAG_ERROR, "code:"
//						+ re.code + "    " + re.jsonStr, null);

			} else {
//				data = new ResultUserList(CommonData.H_FLAG_ERROR, "code:"
//						+ re.code + ErrorCode.ERROR_MSG, null);
			}
		} catch (Exception e) {
//			data = new ResultUserList(CommonData.H_FLAG_ERROR,
//					ErrorCode.ERROR_MSG, null);
//			e.printStackTrace();

		}
		return data;
	}


	protected void onPostExecute(Object result) {
		
			callBack.onSuccess(result);

		

	}
}
